<?php namespace Home\Controller; 

class PayController extends CommonController{

	//构造函数
	public function __init()
	{
		
	}
	public function index(){
		$OrderModel = new \Common\Model\Order;		
	
		$data = $_SESSION;
	
		$order =  $OrderModel->where("o_number",$_SESSION['tid'])->first();
		p($order);
		View::with("order",$order);
		View::with("data",$data);
	    View::make();

	}
	public function add(){
			$OrderModel = new \Common\Model\Order;		
			$tid = Cart::getOrderId();
            if($OrderModel->store($tid)){
            $oid = Db::table("360mall_order")->where("o_number",$tid)->pluck("o_id");
			$_SESSION['total'] = $_SESSION['cart']['total'];
			$_SESSION['tid'] = $tid;
			$_SESSION['total_rows'] = $_SESSION['cart']['total_rows'];			
			unset($_SESSION['cart']);
			header("location:" . __ROOT__ . "/" . "pay_{$oid}.html");
			}

	}
}